package org.fuyd.designpattern.singleton;

/**
 * 双重校验锁
 * 这个是第二种方式的升级版，俗称双重检查锁定，详细介绍请查
 * Created by Jason on 2015/10/22.
 */
public class Singleton7 {
    private volatile static Singleton7 instance = null;

    private Singleton7() {

    }

    public static Singleton7 getInstance() {
        if (instance == null) {
            synchronized (Singleton7.class) {
                if (instance == null) {
                    instance = new Singleton7();
                }
            }
        }
        return instance;
    }
}
